{
 "metadata": {
  "name": "02-Surfaces"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from pyoptools.all import *"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Superficies planas"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "P1=Plane(shape=Circular(radius=(25)))\n",
      "plot3D(P1,center=(0,0,0),size=(60,60),rot=[(0,0,0)],scale=6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "P2=Plane(shape=Rectangular(size=(50,50)))\n",
      "plot3D(P2,center=(0,0,0),size=(60,60),rot=[(0,0,0)],scale=6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "P3=Plane(shape=Triangular(coord=((0,25),(25,-25),(-25,-25))))\n",
      "plot3D(P3,center=(0,0,0),size=(60,60),scale=6) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Superficie esf\u00e9rica "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "S=Spherical(curvature=1/200., shape=Circular(radius=145.),reflectivity=0)\n",
      "plot3D(S,center=(0,0,0),size=(400,400),scale=1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Superficies Cil\u00edndricas "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "S3=Cylinder(radius=36,length=100,reflectivity=1)\n",
      "plot3D(S3,center=(0,0,0),size=(100,100),rot=[(0,pi/32,0)],scale=4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "S1=Cylindrical(shape=Rectangular(size=(50,100)),curvature=1/20.)\n",
      "plot3D(S1,center=(0,0,0),size=(150,150),rot=[(pi/4,0,0)],scale=2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "S2=Cylindrical(shape=Circular(radius=(50)),curvature=1/100.)\n",
      "plot3D(S2,center=(0,0,0),size=(150,150),rot=[(-pi/4,0,0)],scale=2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Superficies asfericas"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "%%latex\n",
      "$$Z=\\frac{(Ax*x^2+Ay*y^2)}{(1+\\sqrt{(1-(1+Kx)*Ax^2*x^2-(1+Ky)*Ay^2*y^2))}}+ poly2d()$$"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "sa=Aspherical(shape=Rectangular(size=(5,5)),Ax=.2,Ay=.2,Kx=.1, Ky=.15, poly=poly2d((0,0,0,.5,0,.5)))\n",
      "plot3D(sa,center=(0,0,5),size=(10,10),rot=[(-3*pi/10,pi/4,0)],scale=40)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "sa=Aspherical(shape=Circular(radius=2.5),Ax=.2,Ay=.2,Kx=.1, Ky=.15, poly=poly2d((0,0,0,.5,0,.5)))\n",
      "plot3D(sa,center=(0,0,5),size=(10,10),rot=[(-3*pi/10,pi/4,0)],scale=40)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}